{extend name="public/layout" /}
{block name="head"}
<style>
  .sms-config {
    display: none;
  }
</style>
{/block}
{block name="body"}

<body>
  <div class="container-fluid p-t-15">
    <div class="card">
      <ul class="nav nav-tabs page-tabs">
        {volist name="group_list" id="vo"}
        <li><a href="/system/config/index.html?group={$vo.dict_code}">{$vo.dict_value}</a></li>
        {/volist}
        <li><a href="/system/config/upload.html">上传配置</a></li>
        <li class="active"><a href="/system/config/sms.html">短信配置</a></li>
      </ul>
      <div class="tab-content">
        <div class="tab-pane active">
          <form id="form" class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-2 control-label">默认发送接口</label>
              <div class="col-sm-4">
                <select id="default-gateways" name="default[gateways]" class="form-control" datatype="*">
                  <option value="">请选择发送接口</option>
                  <option value="aliyun" {eq name="$config.default.gateways" value="aliyun" }selected{/eq}>阿里云</option>
                  <option value="aliyunrest" {eq name="$config.default.gateways" value="aliyunrest" }selected{/eq}>
                    阿里云rest</option>
                  <option value="yunpian" {eq name="$config.default.gateways" value="yunpian" }selected{/eq}>云片</option>
                  <option value="yuntongxun" {eq name="$config.default.gateways" value="yuntongxun" }selected{/eq}>容联云通讯
                  </option>
                  <option value="huyi" {eq name="$config.default.gateways" value="huyi" }selected{/eq}>互亿无线</option>
                  <option value="baidu" {eq name="$config.default.gateways" value="baidu" }selected{/eq}>百度云</option>
                  <option value="rongcloud" {eq name="$config.default.gateways" value="rongcloud" }selected{/eq}>融云
                  </option>
                  <option value="qcloud" {eq name="$config.default.gateways" value="qcloud" }selected{/eq}>腾讯云SMS
                  </option>
                </select>
              </div>
            </div>
            <div class="sms-config aliyun">
              <div class="form-group">
                <label class="col-sm-2 control-label">access_key_id</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyun][access_key_id]"
                    value="{$config.gateways.aliyun.access_key_id}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">access_key_secret</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyun][access_key_secret]"
                    value="{$config.gateways.aliyun.access_key_secret}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">sign_name</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyun][sign_name]"
                    value="{$config.gateways.aliyun.sign_name}" />
                </div>
              </div>
            </div>
            <div class="sms-config aliyunrest">
              <div class="form-group">
                <label class="col-sm-2 control-label">app_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyunrest][app_key]"
                    value="{$config.gateways.aliyunrest.app_key}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">app_secret_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyunrest][app_secret_key]"
                    value="{$config.gateways.aliyunrest.app_secret_key}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">sign_name</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[aliyunrest][sign_name]"
                    value="{$config.gateways.aliyunrest.sign_name}" />
                </div>
              </div>
            </div>
            <div class="sms-config yunpian">
              <div class="form-group">
                <label class="col-sm-2 control-label">api_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[yunpian][api_key]"
                    value="{$config.gateways.yunpian.api_key}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">signature</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[yunpian][signature]"
                    value="{$config.gateways.yunpian.signature}" />
                </div>
              </div>
            </div>
            <div class="sms-config yuntongxun">
              <div class="form-group">
                <label class="col-sm-2 control-label">app_id</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[yuntongxun][app_id]"
                    value="{$config.gateways.yuntongxun.app_id}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">account_sid</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[yuntongxun][account_sid]"
                    value="{$config.gateways.yuntongxun.account_sid}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">account_token</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[yuntongxun][account_token]"
                    value="{$config.gateways.yuntongxun.account_token}" />
                </div>
              </div>
            </div>
            <div class="sms-config huyi">
              <div class="form-group">
                <label class="col-sm-2 control-label">api_id</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[huyi][app_id]"
                    value="{$config.gateways.huyi.api_id}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">api_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[huyi][api_key]"
                    value="{$config.gateways.huyi.api_key}" />
                </div>
              </div>
            </div>
            <div class="sms-config baidu">
              <div class="form-group">
                <label class="col-sm-2 control-label">ak</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[baidu][ak]"
                    value="{$config.gateways.baidu.ak}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">sk</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[baidu][sk]"
                    value="{$config.gateways.baidu.sk}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">invoke_id</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[baidu][invoke_id]"
                    value="{$config.gateways.baidu.invoke_id}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">domain</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[baidu][domain]"
                    value="{$config.gateways.baidu.domain}" />
                </div>
              </div>
            </div>
            <div class="sms-config rongcloud">
              <div class="form-group">
                <label class="col-sm-2 control-label">app_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[rongcloud][app_key]"
                    value="{$config.gateways.rongcloud.app_key}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">sk</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[rongcloud][app_secret]"
                    value="{$config.gateways.rongcloud.app_secret}" />
                </div>
              </div>
            </div>
            <div class="sms-config qcloud">
              <div class="form-group">
                <label class="col-sm-2 control-label">sdk_app_id</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[qcloud][sdk_app_id]"
                    value="{$config.gateways.qcloud.sdk_app_id}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">app_key</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[qcloud][app_key]"
                    value="{$config.gateways.qcloud.app_key}" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">sign_name</label>
                <div class="col-sm-4">
                  <input type="text" class="form-control" name="gateways[qcloud][sign_name]"
                    value="{$config.gateways.qcloud.sign_name}" />
                </div>
              </div>
            </div>
            <div class="form-group">
              <div class="col-sm-10 col-sm-offset-2">
                <div class="pull-left">
                  <button type="button" class="btn btn-primary btn-sub">保存</button>
                  <button type="button" class="btn btn-default btn-reset">重置</button>
                </div>
                <div class="pull-left m-l-15">
                  <p class="error-msg"></p>
                </div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
  <script>
    var defaultGateways = $('#default-gateways');
    defaultGateways.change(function () {
      var defaultGateways = $(this).val();
      $('.sms-config').hide();
      if (!valid.isEmpty(defaultGateways)) $('.' + defaultGateways).show();
    });
    defaultGateways.trigger('change');
    formHelper.subForm(function () {
      helper.refresh();
    });
  </script>
</body>
{/block}